package com.gin.kotlin.no_gay_alliance.database.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.gin.kotlin.no_gay_alliance.database.entity.ReplyHistoryTaskLog
import java.time.ZonedDateTime

@Dao
interface ReplyHistoryTaskLogDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun add(task: ReplyHistoryTaskLog)

    @Query("select * from ReplyHistoryTaskLog where taskId=:taskId and (:after is null or timestamp>=:after) order by id desc")
    fun listByTaskId(taskId: Int, after: ZonedDateTime? = null): List<ReplyHistoryTaskLog>?

    @Query("delete from ReplyHistoryTaskLog  where taskId=:taskId")
    fun delByTaskId(taskId: Int)
}